layui.use(['table', 'jquery'], function () {
    const table = layui.table,
        $ = layui.jquery;

    let teamCode = sessionStorage.getItem("teamMemberCode");

    findUserByTeamCode(teamCode);

    function findUserByTeamCode(teamCode) {

        let params = {
            teamCode: teamCode
        };

        let cols = [[
            {type: 'checkbox', fixed: 'left'}
            , {field: 'id', width: 80, title: 'ID', sort: true, fixed: 'left'}
            , {field: 'code', width: 100, title: '用户编号', sort: true}
            , {field: 'stuId', width: 100, title: '学号', sort: true}
            , {field: 'username', width: 140, title: '用户名'}
            , {
                field: 'avatar', width: 120, title: '头像', templet: function (e) {
                    //判断图片是否为空
                    e.avatar === null || e.avatar === undefined ? e.avatar = '/upload/img_null.png' : e.avatar;
                    return '<img src="' + e.avatar + '" width="80px" height="30px">'
                }
            }
            , {
                field: 'gender', width: 80, title: '性别', templet: e => {
                    return getGenderStatus(e.gender);
                }
            }
            , {field: 'phone', width: 160, title: '电话'}
            , {field: 'birthday', title: '生日', width: 160}
        ]];


        table.render({
            elem: '#dataList'
            , url: LOCAL_CROSS_URL + "/user/findUserByTeamCode"
            , where: params
            , method: 'get'
            , headers: HEADERS
            , request: REQUEST
            , response: RESPONSE
            , cellMinWidth: 80
            , height: 300
            , skin: 'line'
            , even: true
            , page: false
            , limits: [5, 10, 15, 30]
            , limit: 20
            , title: '小组成员表'
            , cols: cols
        });
    }

});